export const TOKEN_STORAGE_KEY = 'token_1';

export const varTypeList: Record<string, any> = {
  STRING: '字符串',
  INTEGER: '整数',
  DECIMAL: '小数',
  DATE_TIME: '日期时间',
  BOOLEAN: '布尔值',
  DATE: '日期',
  ENUM: '枚举'
};

export const CACHE_GRAPH_DATA = 'cache_graph_data';

// { label: '', value: '' }
export const varTypeOptions = Object.keys(varTypeList).map((key) => {
  return {
    label: varTypeList[key],
    value: key
  };
});

export enum NODE_TYPE {
  START = 'START',
  END = 'END',
  DATA_LOAD = 'DATA_LOAD',
  DATA_AGG = 'DATA_AGG',
  // 特征节点
  FEATURE = 'FEATURE',
  MODEL = 'MODEL',
  RULE = 'RULE',
  ASSIGN = 'ASSIGN',
  REALTIME_AGG = 'REALTIME_AGG',
  BRANCH = 'BRANCH',
  // 人工审核
  MANUAL = 'MANUAL',
  // 自动处理
  AUTOMATIC = 'DATA_MODIFY'
}

export type TNodeType = keyof typeof NODE_TYPE;

export const NODE_LIST = {
  [NODE_TYPE.START]: {
    nodeName: '开始节点',
    icon: 'node-start',
    nextNodeList: [NODE_TYPE.RULE, NODE_TYPE.DATA_LOAD, NODE_TYPE.BRANCH, NODE_TYPE.MODEL, NODE_TYPE.AUTOMATIC, NODE_TYPE.FEATURE]
  },
  [NODE_TYPE.END]: {
    nodeName: '结束节点',
    icon: 'node-end',
    nextNodeList: []
  },
  [NODE_TYPE.DATA_LOAD]: {
    nodeName: '数据加载',
    icon: 'node-data-load',
    nextNodeList: [NODE_TYPE.RULE, NODE_TYPE.BRANCH, NODE_TYPE.MODEL, NODE_TYPE.DATA_LOAD, NODE_TYPE.MANUAL, NODE_TYPE.END]
  },
  [NODE_TYPE.DATA_AGG]: {
    nodeName: '数据聚合',
    icon: 'data-agg',
    nextNodeList: []
  },
  [NODE_TYPE.FEATURE]: {
    nodeName: '特征节点',
    icon: 'feature',
    nextNodeList: [
      NODE_TYPE.RULE,
      NODE_TYPE.BRANCH,
      NODE_TYPE.DATA_LOAD,
      NODE_TYPE.MODEL,
      NODE_TYPE.MANUAL,
      NODE_TYPE.AUTOMATIC,
      NODE_TYPE.FEATURE,
      NODE_TYPE.END
    ]
  },
  [NODE_TYPE.MODEL]: {
    nodeName: '模型调用',
    icon: 'node-model',
    nextNodeList: [
      NODE_TYPE.RULE,
      NODE_TYPE.BRANCH,
      NODE_TYPE.DATA_LOAD,
      NODE_TYPE.MODEL,
      NODE_TYPE.MANUAL,
      NODE_TYPE.AUTOMATIC,
      NODE_TYPE.FEATURE,
      NODE_TYPE.END
    ]
  },
  [NODE_TYPE.RULE]: {
    nodeName: '规则节点',
    icon: 'node-rule',
    nextNodeList: [
      NODE_TYPE.DATA_LOAD,
      NODE_TYPE.BRANCH,
      NODE_TYPE.MODEL,
      NODE_TYPE.MANUAL,
      NODE_TYPE.AUTOMATIC,
      NODE_TYPE.FEATURE,
      NODE_TYPE.END
    ]
  },
  [NODE_TYPE.ASSIGN]: {
    nodeName: '变量赋值',
    icon: 'assign',
    nextNodeList: []
  },
  [NODE_TYPE.REALTIME_AGG]: {
    nodeName: '实时聚合',
    icon: 'realtime-agg',
    nextNodeList: []
  },
  [NODE_TYPE.BRANCH]: {
    nodeName: '分支节点',
    icon: 'node-branch',
    nextNodeList: [
      NODE_TYPE.DATA_LOAD,
      NODE_TYPE.RULE,
      NODE_TYPE.MODEL,
      NODE_TYPE.MANUAL,
      NODE_TYPE.AUTOMATIC,
      NODE_TYPE.FEATURE,
      NODE_TYPE.END
    ]
  },
  [NODE_TYPE.MANUAL]: {
    nodeName: '人工节点',
    icon: 'node-manual',
    nextNodeList: [
      NODE_TYPE.DATA_LOAD,
      NODE_TYPE.RULE,
      NODE_TYPE.MODEL,
      NODE_TYPE.MANUAL,
      NODE_TYPE.AUTOMATIC,
      NODE_TYPE.FEATURE,
      NODE_TYPE.END
    ]
  },
  [NODE_TYPE.AUTOMATIC]: {
    nodeName: '自动处理',
    icon: 'node-auto',
    nextNodeList: [
      NODE_TYPE.RULE,
      NODE_TYPE.BRANCH,
      NODE_TYPE.DATA_LOAD,
      NODE_TYPE.MODEL,
      NODE_TYPE.MANUAL,
      NODE_TYPE.FEATURE,
      NODE_TYPE.END
    ]
  }
};

/*  用户角色roleCode
    来源：/role/list
    管理员： 1132
    策略配置岗： 1133
    策略复核岗： 1134
    策略终审岗： 1135
*/

export const ADMIN_ROLECODE = 1132;
export const APPROVE0_ROLECODE = 1133;
export const APPROVE1_ROLECODE = 1134;
export const APPROVE2_ROLECODE = 1135;
